use crate::co;
use crate::decl::*;
use crate::kernel::privs::*;
use crate::msg::*;
use crate::ole::privs::*;
use crate::prelude::*;
use crate::user::privs::*;
pub struct ApproximateViewRect {
pub num_items: Option<u32>,
pub proposed_x: Option<u16>,
pub proposed_y: Option<u16>,
}
unsafe impl MsgSend for ApproximateViewRect {
type RetType = SIZE;
fn convert_ret(&self, v: isize) -> Self::RetType {
SIZE::from(v as u32)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::APPROXIMATEVIEWRECT.into(),
wparam: self.num_items.map_or(-1, |n| n as i32) as _,
lparam: MAKEDWORD(
self.proposed_x.map_or(-1, |x| x as i32) as _,
self.proposed_y.map_or(-1, |y| y as i32) as _,
) as _,
}
}
}
pub struct Arrange {
pub arrangement: co::LVA,
}
unsafe impl MsgSend for Arrange {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::ARRANGE.into(),
wparam: self.arrangement.raw() as _,
lparam: 0,
}
}
}
pub_struct_msg_empty! { CancelEditLabel: co::LVM::CANCELEDITLABEL.into();
}
pub struct CreateDragImage<'a> {
pub index: u32,
pub img_location: &'a mut RECT,
}
unsafe impl<'a> MsgSend for CreateDragImage<'a> {
type RetType = SysResult<HIMAGELIST>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HIMAGELIST::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::CREATEDRAGIMAGE.into(),
wparam: self.index as _,
lparam: self.img_location as *mut _ as _,
}
}
}
pub struct DeleteAllItems {}
unsafe impl MsgSend for DeleteAllItems {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::DELETEALLITEMS.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct DeleteColumn {
pub index: u32,
}
unsafe impl MsgSend for DeleteColumn {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::DELETECOLUMN.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct DeleteItem {
pub index: u32,
}
unsafe impl MsgSend for DeleteItem {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::DELETEITEM.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct EditLabel {
pub index: Option<u32>,
}
unsafe impl MsgSend for EditLabel {
type RetType = SysResult<HWND>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::EDITLABEL.into(),
wparam: self.index.map_or(-1, |i| i as i32) as _,
lparam: 0,
}
}
}
pub struct EnableGroupView {
pub enable: bool,
}
unsafe impl MsgSend for EnableGroupView {
type RetType = SysResult<bool>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v != 0)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::ENABLEGROUPVIEW.into(),
wparam: self.enable as _,
lparam: 0,
}
}
}
pub struct EnsureVisible {
pub index: u32,
pub entirely_visible: bool,
}
unsafe impl MsgSend for EnsureVisible {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::ENSUREVISIBLE.into(),
wparam: self.index as _,
lparam: !self.entirely_visible as _,
}
}
}
pub struct FindItem<'a, 'b> {
pub start_index: Option<u32>,
pub lvfindinfo: &'b LVFINDINFO<'a>,
}
unsafe impl<'a, 'b> MsgSend for FindItem<'a, 'b> {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::FINDITEM.into(),
wparam: self.start_index.map_or(-1, |idx| idx as i32) as _,
lparam: self.lvfindinfo as *const _ as _,
}
}
}
pub struct GetBkColor {}
unsafe impl MsgSend for GetBkColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETBKCOLOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetBkImage<'a, 'b> {
pub lvbkimage: &'b mut LVBKIMAGE<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetBkImage<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETBKIMAGE.into(),
wparam: 0,
lparam: self.lvbkimage as *mut _ as _,
}
}
}
pub struct GetCallbackMask {}
unsafe impl MsgSend for GetCallbackMask {
type RetType = co::LVIS;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LVIS::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETCALLBACKMASK.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetColumn<'a, 'b> {
pub index: u32,
pub lvcolumn: &'b mut LVCOLUMN<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetColumn<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETCOLUMN.into(),
wparam: self.index as _,
lparam: self.lvcolumn as *mut _ as _,
}
}
}
pub struct GetColumnOrderArray<'a> {
pub indexes: &'a mut Vec<u32>,
}
unsafe impl<'a> MsgSend for GetColumnOrderArray<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETCOLUMNORDERARRAY.into(),
wparam: self.indexes.len() as _,
lparam: self.indexes.as_mut_ptr() as _,
}
}
}
pub struct GetColumnWidth {
pub index: u32,
}
unsafe impl MsgSend for GetColumnWidth {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETCOLUMNWIDTH.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct GetCountPerPage {}
unsafe impl MsgSend for GetCountPerPage {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETCOUNTPERPAGE.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetEditControl {}
unsafe impl MsgSend for GetEditControl {
type RetType = Option<HWND>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETEDITCONTROL.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetEmptyText<'a> {
pub text: &'a mut WString,
}
unsafe impl<'a> MsgSend for GetEmptyText<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETEMPTYTEXT.into(),
wparam: self.text.buf_len(),
lparam: unsafe { self.text.as_mut_ptr() } as _,
}
}
}
pub struct GetExtendedListViewStyle {}
unsafe impl MsgSend for GetExtendedListViewStyle {
type RetType = co::LVS_EX;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LVS_EX::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETEXTENDEDLISTVIEWSTYLE.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetFocusedGroup {}
unsafe impl MsgSend for GetFocusedGroup {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETFOCUSEDGROUP.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetFooterInfo<'a, 'b> {
pub info: &'b mut LVFOOTERINFO<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetFooterInfo<'a, 'b> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETFOOTERINFO.into(),
wparam: 0,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetFooterItem<'a, 'b> {
pub index: u32,
pub info: &'b mut LVFOOTERITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetFooterItem<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETFOOTERITEM.into(),
wparam: self.index as _,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetFooterItemRect<'a> {
pub index: u32,
pub rect: &'a mut RECT,
}
unsafe impl<'a> MsgSend for GetFooterItemRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETFOOTERITEMRECT.into(),
wparam: self.index as _,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetFooterRect<'a> {
pub rect: &'a mut RECT,
}
unsafe impl<'a> MsgSend for GetFooterRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETFOOTERRECT.into(),
wparam: 0,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetGroupCount {}
unsafe impl MsgSend for GetGroupCount {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETGROUPCOUNT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
pub id: u32,
pub info: &'h mut LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
}
unsafe impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for GetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETGROUPINFO.into(),
wparam: self.id as _,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetGroupInfoByIndex<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
pub index: u32,
pub info: &'h mut LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
}
unsafe impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for GetGroupInfoByIndex<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETGROUPINFOBYINDEX.into(),
wparam: self.index as _,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetGroupMetrics<'a> {
pub info: &'a mut LVGROUPMETRICS,
}
unsafe impl<'a> MsgSend for GetGroupMetrics<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETGROUPMETRICS.into(),
wparam: 0,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetGroupRect<'a> {
pub id: u32,
pub flags: co::LVGGR,
pub rect: &'a mut RECT,
}
unsafe impl<'a> MsgSend for GetGroupRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
self.rect.top = self.flags.raw();
WndMsg {
msg_id: co::LVM::GETGROUPRECT.into(),
wparam: self.id as _,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetGroupState {
pub id: u32,
pub mask: co::LVGS,
}
unsafe impl MsgSend for GetGroupState {
type RetType = co::LVGS;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LVGS::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETGROUPSTATE.into(),
wparam: self.id as _,
lparam: self.mask.raw() as _,
}
}
}
pub struct GetHeader {}
unsafe impl MsgSend for GetHeader {
type RetType = SysResult<HWND>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETHEADER.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetHotCursor {}
unsafe impl MsgSend for GetHotCursor {
type RetType = SysResult<HCURSOR>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|p| unsafe { HCURSOR::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETHOTCURSOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetHotItem {}
unsafe impl MsgSend for GetHotItem {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|idx| idx as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETHOTITEM.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetHoverTime {}
unsafe impl MsgSend for GetHoverTime {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|idx| idx as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETHOVERTIME.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetImageList {
pub kind: co::LVSIL,
}
unsafe impl MsgSend for GetImageList {
type RetType = Option<HIMAGELIST>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HIMAGELIST::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETIMAGELIST.into(),
wparam: self.kind.raw() as _,
lparam: 0,
}
}
}
pub struct GetInsertMark<'a> {
pub info: &'a mut LVINSERTMARK,
}
unsafe impl<'a> MsgSend for GetInsertMark<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETINSERTMARK.into(),
wparam: 0,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetInsertMarkColor {}
unsafe impl MsgSend for GetInsertMarkColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETINSERTMARKCOLOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetInsertMarkRect<'a> {
pub rect: &'a mut RECT,
}
unsafe impl<'a> MsgSend for GetInsertMarkRect<'a> {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETINSERTMARKRECT.into(),
wparam: 0,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetISearchString<'a> {
pub buffer: Option<&'a mut WString>,
}
unsafe impl<'a> MsgSend for GetISearchString<'a> {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|c| c as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETISEARCHSTRING.into(),
wparam: 0,
lparam: self.buffer.as_mut().map_or(0, |buf| unsafe { buf.as_mut_ptr() } as _),
}
}
}
pub struct GetItem<'a, 'b> {
pub lvitem: &'b mut LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetItem<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEM.into(),
wparam: 0,
lparam: self.lvitem as *mut _ as _,
}
}
}
pub struct GetItemCount {}
unsafe impl MsgSend for GetItemCount {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEMCOUNT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetItemIndexRect<'a, 'b> {
pub lvitemindex: &'a LVITEMINDEX,
pub rect: &'b mut RECT,
pub index: u32,
pub portion: co::LVIR,
}
unsafe impl<'a, 'b> MsgSend for GetItemIndexRect<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
self.rect.top = self.index as _;
self.rect.left = self.portion.raw() as _;
WndMsg {
msg_id: co::LVM::GETITEMINDEXRECT.into(),
wparam: self.lvitemindex as *const _ as _,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetItemPosition<'a> {
pub index: u32,
pub pos: &'a mut POINT,
}
unsafe impl<'a> MsgSend for GetItemPosition<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEMPOSITION.into(),
wparam: self.index as _,
lparam: self.pos as *mut _ as _,
}
}
}
pub struct GetItemRect<'a> {
pub index: u32,
pub rect: &'a mut RECT,
pub portion: co::LVIR,
}
unsafe impl<'a> MsgSend for GetItemRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
self.rect.left = self.portion.raw() as _;
WndMsg {
msg_id: co::LVM::GETITEMRECT.into(),
wparam: self.index as _,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetItemSpacing {
pub is_small_icon_view: bool,
}
unsafe impl MsgSend for GetItemSpacing {
type RetType = SIZE;
fn convert_ret(&self, v: isize) -> Self::RetType {
SIZE::from(v as u32)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEMSTATE.into(),
wparam: self.is_small_icon_view as _,
lparam: 0,
}
}
}
pub struct GetItemState {
pub index: u32,
pub mask: co::LVIS,
}
unsafe impl MsgSend for GetItemState {
type RetType = co::LVIS;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LVIS::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEMSTATE.into(),
wparam: self.index as _,
lparam: self.mask.raw() as _,
}
}
}
pub struct GetItemText<'a, 'b> {
pub index: u32,
pub lvitem: &'b mut LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetItemText<'a, 'b> {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETITEMTEXT.into(),
wparam: self.index as _,
lparam: self.lvitem as *mut _ as _,
}
}
}
pub struct GetNextItem {
pub initial_index: Option<u32>,
pub relationship: co::LVNI,
}
unsafe impl MsgSend for GetNextItem {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETNEXTITEM.into(),
wparam: self.initial_index.map_or(-1, |idx| idx as i32) as _,
lparam: self.relationship.raw() as _,
}
}
}
pub struct GetNextItemIndex<'a> {
pub initial_item: &'a mut LVITEMINDEX,
pub relationship: co::LVNI,
}
unsafe impl<'a> MsgSend for GetNextItemIndex<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETNEXTITEMINDEX.into(),
wparam: self.initial_item as *mut _ as _,
lparam: self.relationship.raw() as _,
}
}
}
pub struct GetNumberOfWorkAreas<'a> {
pub num: &'a mut u32,
}
unsafe impl<'a> MsgSend for GetNumberOfWorkAreas<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETNUMBEROFWORKAREAS.into(),
wparam: 0,
lparam: self.num as *mut _ as _,
}
}
}
pub struct GetOrigin<'a> {
pub origin: &'a mut POINT,
}
unsafe impl<'a> MsgSend for GetOrigin<'a> {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETORIGIN.into(),
wparam: 0,
lparam: self.origin as *mut _ as _,
}
}
}
pub struct GetOutlineColor {}
unsafe impl MsgSend for GetOutlineColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETOUTLINECOLOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetSelectedColumn {}
unsafe impl MsgSend for GetSelectedColumn {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETSELECTEDCOLUMN.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetSelectedCount {}
unsafe impl MsgSend for GetSelectedCount {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETSELECTEDCOUNT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetSelectionMark {}
unsafe impl MsgSend for GetSelectionMark {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETSELECTIONMARK.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetStringWidth {
pub text: WString,
}
unsafe impl MsgSend for GetStringWidth {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|len| len as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETSTRINGWIDTH.into(),
wparam: 0,
lparam: self.text.as_ptr() as _,
}
}
}
pub struct GetSubItemRect<'a> {
pub item_index: u32,
pub subitem_index: u32,
pub rect: &'a mut RECT,
pub portion: co::LVIR,
}
unsafe impl<'a> MsgSend for GetSubItemRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
self.rect.left = self.portion.raw() as _;
self.rect.top = self.subitem_index as _;
WndMsg {
msg_id: co::LVM::GETSUBITEMRECT.into(),
wparam: self.item_index as _,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetTextBkColor {}
unsafe impl MsgSend for GetTextBkColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTEXTBKCOLOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetTextColor {}
unsafe impl MsgSend for GetTextColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTEXTCOLOR.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetTileInfo<'a, 'b> {
pub info: &'b mut LVTILEINFO<'a>,
}
unsafe impl<'a, 'b> MsgSend for GetTileInfo<'a, 'b> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTILEINFO.into(),
wparam: 0,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetTileViewInfo<'a> {
pub info: &'a mut LVTILEVIEWINFO,
}
unsafe impl<'a> MsgSend for GetTileViewInfo<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTILEVIEWINFO.into(),
wparam: 0,
lparam: self.info as *mut _ as _,
}
}
}
pub struct GetTooltips {}
unsafe impl MsgSend for GetTooltips {
type RetType = Option<HWND>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTOOLTIPS.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetTopIndex {}
unsafe impl MsgSend for GetTopIndex {
type RetType = u32;
fn convert_ret(&self, v: isize) -> Self::RetType {
v as _
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETTOPINDEX.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetUnicodeFormat {}
unsafe impl MsgSend for GetUnicodeFormat {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETUNICODEFORMAT.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetView {}
unsafe impl MsgSend for GetView {
type RetType = co::LV_VIEW;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LV_VIEW::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETVIEW.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct GetViewRect<'a> {
pub rect: &'a mut RECT,
}
unsafe impl<'a> MsgSend for GetViewRect<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETVIEWRECT.into(),
wparam: 0,
lparam: self.rect as *mut _ as _,
}
}
}
pub struct GetWorkAreas<'a> {
pub rects: &'a mut [RECT],
}
unsafe impl<'a> MsgSend for GetWorkAreas<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::GETWORKAREAS.into(),
wparam: self.rects.len() as _,
lparam: self.rects.as_mut_ptr() as _,
}
}
}
pub struct HasGroup {
pub id: u32,
}
unsafe impl MsgSend for HasGroup {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::HASGROUP.into(),
wparam: self.id as _,
lparam: 0,
}
}
}
pub struct HitTest<'a> {
pub info: &'a mut LVHITTESTINFO,
}
unsafe impl<'a> MsgSend for HitTest<'a> {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::HITTEST.into(),
wparam: -1 as _,
lparam: self.info as *mut _ as _,
}
}
}
pub struct InsertColumn<'a, 'b> {
pub index: u32,
pub column: &'b LVCOLUMN<'a>,
}
unsafe impl<'a, 'b> MsgSend for InsertColumn<'a, 'b> {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::INSERTCOLUMN.into(),
wparam: self.index as _,
lparam: self.column as *const _ as _,
}
}
}
pub struct InsertGroup<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
pub group: &'h LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
}
unsafe impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for InsertGroup<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::INSERTGROUP.into(),
wparam: 0,
lparam: self.group as *const _ as _,
}
}
}
pub struct InsertGroupSorted<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
pub group: &'h LVINSERTGROUPSORTED<'a, 'b, 'c, 'd, 'e, 'f, 'g>,
}
unsafe impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for InsertGroupSorted<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::INSERTGROUPSORTED.into(),
wparam: 0,
lparam: self.group as *const _ as _,
}
}
}
pub struct InsertItem<'a, 'b> {
pub item: &'b LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for InsertItem<'a, 'b> {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::INSERTITEM.into(),
wparam: 0,
lparam: self.item as *const _ as _,
}
}
}
pub struct InsertMarkHitTest<'a> {
pub point: POINT,
pub insert_mark: &'a LVINSERTMARK,
}
unsafe impl<'a, 'b> MsgSend for InsertMarkHitTest<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::INSERTMARKHITTEST.into(),
wparam: &self.point as *const _ as _,
lparam: self.insert_mark as *const _ as _,
}
}
}
pub struct IsGroupViewEnabled {}
unsafe impl MsgSend for IsGroupViewEnabled {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::ISGROUPVIEWENABLED.into(),
wparam: 0,
lparam: 0,
}
}
}
pub struct IsItemVisible {
pub index: u32,
}
unsafe impl MsgSend for IsItemVisible {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::ISITEMVISIBLE.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct MapIdToIndex {
pub id: u32,
}
unsafe impl MsgSend for MapIdToIndex {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::MAPIDTOINDEX.into(),
wparam: self.id as _,
lparam: 0,
}
}
}
pub struct MapIndexToId {
pub index: u32,
}
unsafe impl MsgSend for MapIndexToId {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::MAPINDEXTOID.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct RedrawItems {
pub first_index: u32,
pub last_index: u32,
}
unsafe impl MsgSend for RedrawItems {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::REDRAWITEMS.into(),
wparam: self.first_index as _,
lparam: self.last_index as _,
}
}
}
pub_struct_msg_empty! { RemoveAllGroups: co::LVM::REMOVEALLGROUPS.into();
}
pub struct RemoveGroup {
pub id: u32,
}
unsafe impl MsgSend for RemoveGroup {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|id| id as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::REMOVEGROUP.into(),
wparam: self.id as _,
lparam: 0,
}
}
}
pub struct Scroll {
pub horizontal: i32,
pub vertical: i32,
}
unsafe impl MsgSend for Scroll {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SCROLL.into(),
wparam: self.horizontal as _,
lparam: self.vertical as _,
}
}
}
pub struct SetBkColor {
pub color: Option<COLORREF>,
}
unsafe impl MsgSend for SetBkColor {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETBKCOLOR.into(),
wparam: 0,
lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
}
}
}
pub struct SetBkImage<'a, 'b> {
pub lvbkimage: &'b LVBKIMAGE<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetBkImage<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETBKIMAGE.into(),
wparam: 0,
lparam: self.lvbkimage as *const _ as _,
}
}
}
pub struct SetCallbackMask {
pub mask: co::LVIS,
}
unsafe impl MsgSend for SetCallbackMask {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETCALLBACKMASK.into(),
wparam: self.mask.raw() as _,
lparam: 0,
}
}
}
pub struct SetColumn<'a, 'b> {
pub index: u32,
pub lvcolumn: &'b LVCOLUMN<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetColumn<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETCOLUMN.into(),
wparam: self.index as _,
lparam: self.lvcolumn as *const _ as _,
}
}
}
pub struct SetColumnOrderArray<'a> {
pub order: &'a [u32],
}
unsafe impl<'a> MsgSend for SetColumnOrderArray<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETCOLUMNORDERARRAY.into(),
wparam: self.order.len() as _,
lparam: vec_ptr(self.order) as _,
}
}
}
pub struct SetColumnWidth {
pub index: u32,
pub width: u32,
}
unsafe impl MsgSend for SetColumnWidth {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETCOLUMNWIDTH.into(),
wparam: self.index as _,
lparam: self.width as _,
}
}
}
pub struct SetExtendedListViewStyle {
pub style: co::LVS_EX,
pub mask: co::LVS_EX,
}
unsafe impl MsgSend for SetExtendedListViewStyle {
type RetType = co::LVS_EX;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { co::LVS_EX::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETEXTENDEDLISTVIEWSTYLE.into(),
wparam: self.style.raw() as _,
lparam: self.mask.raw() as _,
}
}
}
pub struct SetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
pub id: u32,
pub info: &'h LVGROUP<'a, 'b, 'c, 'd, 'e, 'f, 'g>
}
unsafe impl<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> MsgSend for SetGroupInfo<'a, 'b, 'c, 'd, 'e, 'f, 'g, 'h> {
type RetType = SysResult<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETGROUPINFO.into(),
wparam: self.id as _,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetGroupMetrics<'a> {
pub info: &'a LVGROUPMETRICS,
}
unsafe impl<'a> MsgSend for SetGroupMetrics<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETGROUPMETRICS.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetHotCursor<'a> {
pub hcursor: Option<&'a HCURSOR>,
}
unsafe impl<'a> MsgSend for SetHotCursor<'a> {
type RetType = Option<HCURSOR>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HCURSOR::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETHOTCURSOR.into(),
wparam: 0,
lparam: self.hcursor.map_or(0, |h| h.ptr() as _),
}
}
}
pub struct SetHotItem {
pub index: Option<u32>,
}
unsafe impl MsgSend for SetHotItem {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETHOTITEM.into(),
wparam: self.index.unwrap_or(0) as _,
lparam: 0,
}
}
}
pub struct SetHoverTime {
pub ms: Option<u32>,
}
unsafe impl MsgSend for SetHoverTime {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETHOVERTIME.into(),
wparam: self.ms.map_or(-1, |ms| ms as i32) as _,
lparam: 0,
}
}
}
pub struct SetIconSpacing {
pub size: SIZE,
}
unsafe impl MsgSend for SetIconSpacing {
type RetType = SIZE;
fn convert_ret(&self, v: isize) -> Self::RetType {
SIZE::from(v as u32)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETICONSPACING.into(),
wparam: 0,
lparam: u32::from(self.size) as _,
}
}
}
pub struct SetImageList {
pub kind: co::LVSIL,
pub himagelist: Option<HIMAGELIST>,
}
unsafe impl MsgSend for SetImageList {
type RetType = Option<HIMAGELIST>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HIMAGELIST::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETIMAGELIST.into(),
wparam: self.kind.raw() as _,
lparam: self.himagelist.as_ref().map_or(0, |h| h.ptr() as _),
}
}
}
pub struct SetInfoTip<'a, 'b> {
pub info: &'b LVSETINFOTIP<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetInfoTip<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETINFOTIP.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetInsertMark<'a> {
pub info: &'a LVINSERTMARK,
}
unsafe impl<'a> MsgSend for SetInsertMark<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETINSERTMARK.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetInsertMarkColor {
pub color: COLORREF,
}
unsafe impl MsgSend for SetInsertMarkColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETINSERTMARKCOLOR.into(),
wparam: 0,
lparam: u32::from(self.color) as _,
}
}
}
pub struct SetItem<'a, 'b> {
pub lvitem: &'b LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetItem<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEM.into(),
wparam: 0,
lparam: self.lvitem as *const _ as _,
}
}
}
pub struct SetItemCount {
pub count: u32,
pub behavior: Option<co::LVSICF>,
}
unsafe impl MsgSend for SetItemCount {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMCOUNT.into(),
wparam: self.count as _,
lparam: self.behavior.unwrap_or_default().raw() as _,
}
}
}
pub struct SetItemIndexState<'a, 'b, 'c> {
pub lvitemindex: &'a LVITEMINDEX,
pub lvitem: &'c LVITEM<'b>,
}
unsafe impl<'a, 'b, 'c> MsgSend for SetItemIndexState<'a, 'b, 'c> {
type RetType = HrResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
ok_to_hrresult(v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMINDEXSTATE.into(),
wparam: self.lvitemindex as *const _ as _,
lparam: self.lvitem as *const _ as _,
}
}
}
pub struct SetItemPosition {
pub index: u32,
pub position: POINT,
}
unsafe impl MsgSend for SetItemPosition {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMPOSITION.into(),
wparam: self.index as _,
lparam: u32::from(self.position) as _,
}
}
}
pub struct SetItemPosition32 {
pub index: u32,
pub position: POINT,
}
unsafe impl MsgSend for SetItemPosition32 {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMPOSITION32.into(),
wparam: self.index as _,
lparam: &self.position as *const _ as _,
}
}
}
pub struct SetItemState<'a, 'b> {
pub index: Option<u32>,
pub lvitem: &'b LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetItemState<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMSTATE.into(),
wparam: self.index.map_or(-1, |idx| idx as i32) as _,
lparam: self.lvitem as *const _ as _,
}
}
}
pub struct SetItemText<'a, 'b> {
pub index: u32,
pub lvitem: &'b LVITEM<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetItemText<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETITEMTEXT.into(),
wparam: self.index as _,
lparam: self.lvitem as *const _ as _,
}
}
}
pub struct SetOutlineColor {
pub color: COLORREF,
}
unsafe impl MsgSend for SetOutlineColor {
type RetType = COLORREF;
fn convert_ret(&self, v: isize) -> Self::RetType {
unsafe { COLORREF::from_raw(v as _) }
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETOUTLINECOLOR.into(),
wparam: 0,
lparam: u32::from(self.color) as _,
}
}
}
pub struct SetSelectedColumn {
pub index: u32,
}
unsafe impl MsgSend for SetSelectedColumn {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETSELECTEDCOLUMN.into(),
wparam: self.index as _,
lparam: 0,
}
}
}
pub struct SetSelectionMark {
pub index: Option<u32>,
}
unsafe impl MsgSend for SetSelectionMark {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETSELECTIONMARK.into(),
wparam: 0,
lparam: self.index.map_or(-1, |idx| idx as i32) as _,
}
}
}
pub struct SetTextBkColor {
pub color: Option<COLORREF>,
}
unsafe impl MsgSend for SetTextBkColor {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETTEXTBKCOLOR.into(),
wparam: 0,
lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
}
}
}
pub struct SetTextColor {
pub color: Option<COLORREF>,
}
unsafe impl MsgSend for SetTextColor {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETTEXTCOLOR.into(),
wparam: 0,
lparam: self.color.map_or(co::CLR::NONE.raw(), |c| c.raw()) as _,
}
}
}
pub struct SetTileInfo<'a, 'b> {
pub info: &'b LVTILEINFO<'a>,
}
unsafe impl<'a, 'b> MsgSend for SetTileInfo<'a, 'b> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETTILEINFO.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetTileViewInfo<'a> {
pub info: &'a LVTILEVIEWINFO,
}
unsafe impl<'a> MsgSend for SetTileViewInfo<'a> {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETTILEVIEWINFO.into(),
wparam: 0,
lparam: self.info as *const _ as _,
}
}
}
pub struct SetTooltips<'a> {
pub htooltips: Option<&'a HWND>,
}
unsafe impl<'a> MsgSend for SetTooltips<'a> {
type RetType = Option<HWND>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_none(v).map(|p| unsafe { HWND::from_ptr(p as _) })
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETTOOLTIPS.into(),
wparam: self.htooltips.map_or(0, |h| h.ptr() as _),
lparam: 0,
}
}
}
pub struct SetUnicodeFormat {
pub use_unicode: bool,
}
unsafe impl MsgSend for SetUnicodeFormat {
type RetType = bool;
fn convert_ret(&self, v: isize) -> Self::RetType {
v != 0
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETUNICODEFORMAT.into(),
wparam: self.use_unicode as _,
lparam: 0,
}
}
}
pub struct SetView {
pub view: co::LV_VIEW,
}
unsafe impl MsgSend for SetView {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETVIEW.into(),
wparam: self.view.raw() as _,
lparam: 0,
}
}
}
pub struct SetWorkAreas<'a> {
pub rects: Option<&'a [RECT]>,
}
unsafe impl<'a> MsgSend for SetWorkAreas<'a> {
type RetType = ();
fn convert_ret(&self, _: isize) -> Self::RetType {
()
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SETWORKAREAS.into(),
wparam: self.rects.map_or(0, |r| r.len() as _),
lparam: self.rects.map_or(0, |r| vec_ptr(r) as _),
}
}
}
pub struct SortGroups {
pub callback: Option<PFNLVGROUPCOMPARE>,
pub param: Option<isize>,
}
unsafe impl MsgSend for SortGroups {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SORTGROUPS.into(),
wparam: self.callback.map_or(0, |cb| cb as _),
lparam: self.param.unwrap_or(0),
}
}
}
pub struct SortItems {
pub param: isize,
pub callback: PFNLVCOMPARE,
}
unsafe impl MsgSend for SortItems {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SORTITEMS.into(),
wparam: self.param as _,
lparam: self.callback as _,
}
}
}
pub struct SortItemsEx {
pub param: isize,
pub callback: PFNLVCOMPARE,
}
unsafe impl MsgSend for SortItemsEx {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SORTITEMSEX.into(),
wparam: self.param as _,
lparam: self.callback as _,
}
}
}
pub struct SubItemHitTest<'a> {
pub info: &'a mut LVHITTESTINFO,
}
unsafe impl<'a> MsgSend for SubItemHitTest<'a> {
type RetType = Option<u32>;
fn convert_ret(&self, v: isize) -> Self::RetType {
minus1_as_none(v).map(|v| v as _)
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::SUBITEMHITTEST.into(),
wparam: -1 as _,
lparam: self.info as *mut _ as _,
}
}
}
pub struct Update {
pub index: u32,
}
unsafe impl MsgSend for Update {
type RetType = SysResult<()>;
fn convert_ret(&self, v: isize) -> Self::RetType {
zero_as_badargs(v).map(|_| ())
}
fn as_generic_wm(&mut self) -> WndMsg {
WndMsg {
msg_id: co::LVM::UPDATE.into(),
wparam: self.index as _,
lparam: 0,
}
}
}